package server.workwithgarage;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import abstractservlet.AbstractServlet;
import autoservice.api.controller.IAutoservice;
import controllers.Autoservice;

@WebServlet("/AddGarage")
public class AddGarage extends AbstractServlet {
	private static final long serialVersionUID = 1L;
	private IAutoservice autoservice = Autoservice.getInstance();
	private static final String NUMBER_GARAGE = "numberGarage";
	private static final String ADD_GARAGE_PAGE = "/workwithgaragepages/AddGaragePage.jsp";
	private static final String ADD_GARAGE_OPERAT = "add garage";

	public AddGarage() {
		super();

	}

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		String parameters = (String) request.getParameter(NUMBER_GARAGE);
		super.navigate(request, response, ADD_GARAGE_OPERAT, autoservice
				.addGarage(parameters).get(0), ADD_GARAGE_PAGE);
	}

}
